using System;
using System.Data;
using System.Collections.Generic;
using System.Data.SqlClient;
using Core;

namespace DataAccess
{
    public class tbPowers_Proxy
    {
        log4net.ILog log = log4net.LogManager.GetLogger("tbPowers"); Popular cur = new tbPowers();
        public bool Insert_tbPowers_Proxy(Popular cn)
        {
            bool kq = true;
            try
            {
                kq = cur.Insert(cn);
            }
            catch (Exception)
            {
                kq = false;
            }
            if (kq)
                log.Info(" form tbPowers insert success");
            else
                log.Info("form tbPowers insert fail");
            return kq;
        }
        public bool Update_tbPowers_Proxy(Popular cn)
        {
            bool kq = true;
            try
            {
                kq = cur.Update(cn);
            }
            catch (Exception) { kq = false; }
            if (kq)
                log.Info(" form tbPowers update success");
            else
                log.Info("form tbPowers update fail");
            return kq;
        }
        public bool Delete_tbPowers_Proxy(object b)
        {
            bool kq = true;
            try
            {
                kq = cur.Delete(b);
            }
            catch (Exception) { kq = false; }
            if (kq)
                log.Info(" form tbPowers delete success");
            else
                log.Info("form tbPowers delete fail");
            return kq;
        }
        public IDataReader GetById_tbPowers_Proxy(object b)
        {
            log.Info(" form tbPowers Search by Id");
            try { return cur.Select_ID(b); }
            catch (Exception) { throw; }
        }
        public IDataReader GetByName_tbPowers_Proxy(object b)
        {
            log.Info(" form tbPowers Search by Name");
            return cur.Select_Name(b);
        }
        public IDataReader SelectNo_tbPowers_Proxy(object b)
        {
            log.Info(" form tbPowers Search ");
            if (ConvertType.ToInt(b) != 0)
                return cur.Select_ID(b);
            return cur.Select_Name(b);
        }
        public IDataReader SelectAll_tbPowers_Proxy()
        {
            log.Info(" form tbPowers Load data");
            try { return cur.SelectAll(); }
            catch (Exception) { throw; }
        }
        public List<tbPowers> GetByGroupID(object b)
        {
            tbPowers kh = new tbPowers();
            return kh.GetByGroupID(b);
        }

        public List<tbPowers> GetByMenu(object b)
        {
            tbPowers kh = new tbPowers();
            return kh.GetByMenu(b);
        }

        public List<tbPowers> SelectAlltbPowers_Proxy()
        {
            tbPowers kh = new tbPowers();
            return kh.SelectAllToList();
        }
    }
}